classes = [
    {"name": "abyss", "age": 25, "grade": "A"},
    {"name": "kin", "age": 23, "grade": "B"},
    {"name": "tian", "age": 24, "grade": "B"},
    {"name": "hun", "age": 26, "grade": "A"},
    {"name": "exe", "age": 21, "grade": "A"}
]

#常规函数
def c_age(d):
	return d['age']
print(sorted(classes,key=c_age,reverse=True))

#匿名函数
print(sorted(classes,key=lambda x:x['age'],reverse=False))

#通过`map`函数将上述同学的`age`+1
def m_age(m):
	d = {}
	d['age'] = m['age'] + 1
	m.update(d)
	return m


classes_age = list(map(m_age,classes))
print(classes_age)

#通过`filter`函数过滤掉上述同学中`grade`是`A`的同学
print(list(filter(lambda g:g['grade'] != 'A',classes)))


#使用递归来重构斐波那契函数
def fei(n):
	if n == 0:
		return 0
	elif n <= 1:
		return 1
	else:
		return fei(n-1) + fei(n-2)
#第10项的值
print(fei(10))
#前面i项各自的值
for i in range(int(input())):
	print(fei(i))



